using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MBMC.Dialogs
{
    public partial class Project_Properties : Form
    {
        string mbfolder;
        int modtimesec;
        public Project_Properties(string ActualMBFolder, int modtime)
        {
            InitializeComponent();
            mbfolder = ActualMBFolder;
            modtimesec = modtime;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            comboBox1.Enabled = true;
        }

        private void Project_Properties_Load(object sender, EventArgs e)
        {
            comboBox1.Enabled = false;
            try
            {
                richTextBox1.LoadFile(mbfolder + "/mbmc/info.mbmcp");
                pictureBox1.Load(mbfolder + "/mbmc/data5.mbmcp");
                richTextBox2.LoadFile(mbfolder + "/mbmc/data4.mbmcp");
                comboBox1.Text = richTextBox2.Text;
            }
            catch
            {
                richTextBox1.Text = "Information not exist!";
            }
            MatoPrograms.Time.Time t = new MatoPrograms.Time.Time();
            t = t.ReturnTime(modtimesec);
            label4.Text = "Total time spent it on: " + t.Hours.ToString() + " hours, " + t.Minutes.ToString() + " minutes," + t.Seconds.ToString() + " seconds.";
        }

        private void button3_Click(object sender, EventArgs e)
        {
            richTextBox1.Enabled = true;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            pictureBox1.Image.Save(mbfolder + "/mbmc/data5.mbmcp");
            richTextBox1.SaveFile(mbfolder + "/mbmc/data3.mbmcp");
            richTextBox2.Text = comboBox1.Text;
            richTextBox2.SaveFile(mbfolder + "/mbmc/data4.mbmcp");
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void button4_Click(object sender, EventArgs e)
        {
            openFileDialog1.ShowDialog();
        }

        private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            pictureBox1.Load(openFileDialog1.SafeFileName);
        }
    }
}